package cate.common.table.activity.restrictcall.sheet;

import cate.common.table.ESheet;
import cate.common.table.activity.restrictcall.row.CallItemBaseRow;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class HeroPoolSheet extends ESheet<CallItemBaseRow> {
    public Map<Integer, List<CallItemBaseRow>> groupMap;
    @Override
    public String getSheetName() {
        return "英雄库";
    }
    @Override
    protected void onLoaded() {
        super.onLoaded();
        groupMap = getList().stream().collect(Collectors.groupingBy(row-> row.callGroup));
    }

    public List<CallItemBaseRow> getListByGroup(int group) {
        return groupMap.get(group);
    }

    public CallItemBaseRow getRowByTid(int tid) {
        for (CallItemBaseRow row :
                getList()) {
            if (Integer.parseInt(row.propId) == tid) {
                return row;
            }
        }
        return null;
    }
}
